import {DXMResponse} from "./common";
import { invoke } from "@tauri-apps/api/core";
const dxc_name = "EcommerceDataSourceService"
const dxc_version = "0.0.1"
export enum Gender { 
  male = 1, 
  female = 2, 
}
export type UserInfo = { 
  user_id: string, 
  gender: Gender, 
  age: number, 
  register_time: string, 
}
export type UserLoginInfo = { 
  user_id: string, 
  handle_time: string, 
  is_login: boolean, 
}
export type ProductSaleInfo = { 
  user_id: string, 
  product_id: string, 
  product_category: string, 
  num: number, 
  price: number, 
  buy_time: string, 
}
export async function SubscribeData () { 
    const ret = await invoke("invoke_dxc", {
            invokeRequest: {
              dxc_name,
              dxc_version,
              api: "SubscribeData",
              params: {}
            }
  });
  return ret as DXMResponse<{}>;
} 

export async function PlayProductSaleData () { 
    const ret = await invoke("invoke_dxc", {
            invokeRequest: {
              dxc_name,
              dxc_version,
              api: "PlayProductSaleData",
              params: {}
            }
  });
  return ret as DXMResponse<{}>;
} 

export async function PlayUserRegisterData () { 
    const ret = await invoke("invoke_dxc", {
            invokeRequest: {
              dxc_name,
              dxc_version,
              api: "PlayUserRegisterData",
              params: {}
            }
  });
  return ret as DXMResponse<{}>;
} 

export async function PlayUserLoginData () { 
    const ret = await invoke("invoke_dxc", {
            invokeRequest: {
              dxc_name,
              dxc_version,
              api: "PlayUserLoginData",
              params: {}
            }
  });
  return ret as DXMResponse<{}>;
} 

